<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  

  
  <title>git基础命令应用 | 诶无痕和诶有痕</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="git 命令ls查看当前的文件的内容列表  pwd查看当前文件或者文件夹的系统路径  cd XXX（目录名称 或者 文件夹名称）进入某个目录或者某个文件夹  cd.. 返回上一级 cd..&#x2F;..返回上一级的上一级 cd &#x2F;返回根路径 cd (盘符):切换盘符  mkdir xxx（在当前目录下）创建一个文件夹  touch  xxx （在当前目录下） 创建一个文件  rm xxx删除一个文件 rm">
<meta property="og:type" content="article">
<meta property="og:title" content="git基础命令应用">
<meta property="og:url" content="http://example.com/2022/03/14/git%E5%9F%BA%E7%A1%80%E5%91%BD%E4%BB%A4%E5%BA%94%E7%94%A8/index.html">
<meta property="og:site_name" content="诶无痕和诶有痕">
<meta property="og:description" content="git 命令ls查看当前的文件的内容列表  pwd查看当前文件或者文件夹的系统路径  cd XXX（目录名称 或者 文件夹名称）进入某个目录或者某个文件夹  cd.. 返回上一级 cd..&#x2F;..返回上一级的上一级 cd &#x2F;返回根路径 cd (盘符):切换盘符  mkdir xxx（在当前目录下）创建一个文件夹  touch  xxx （在当前目录下） 创建一个文件  rm xxx删除一个文件 rm">
<meta property="og:locale" content="zh_CH">
<meta property="og:image" content="http://example.com/images/1.png">
<meta property="og:image" content="http://example.com/images/2.png">
<meta property="og:image" content="http://example.com/images/3.png">
<meta property="og:image" content="http://example.com/images/4.png">
<meta property="og:image" content="http://example.com/images/5.png">
<meta property="og:image" content="http://example.com/images/6.png">
<meta property="og:image" content="http://example.com/images/7.png">
<meta property="og:image" content="http://example.com/images/8.png">
<meta property="article:published_time" content="2022-03-14T11:49:12.000Z">
<meta property="article:modified_time" content="2022-03-14T12:33:54.491Z">
<meta property="article:author" content="诶无痕和诶有痕">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://example.com/images/1.png">
  
    <link rel="alternate" href="/atom.xml" title="诶无痕和诶有痕" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  
<link rel="stylesheet" href="/css/style.css">

<meta name="generator" content="Hexo 5.4.1"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">诶无痕和诶有痕</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://example.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-git基础命令应用" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2022/03/14/git%E5%9F%BA%E7%A1%80%E5%91%BD%E4%BB%A4%E5%BA%94%E7%94%A8/" class="article-date">
  <time datetime="2022-03-14T11:49:12.000Z" itemprop="datePublished">2022-03-14</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      git基础命令应用
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="git-命令"><a href="#git-命令" class="headerlink" title="git 命令"></a>git 命令</h1><h2 id="ls"><a href="#ls" class="headerlink" title="ls"></a>ls</h2><p>查看当前的文件的内容列表</p>
<p><img src="/images/1.png" alt="img"></p>
<h2 id="pwd"><a href="#pwd" class="headerlink" title="pwd"></a>pwd</h2><p>查看当前文件或者文件夹的系统路径</p>
<p><img src="/images/2.png" alt="img"></p>
<h2 id="cd-XXX（目录名称-或者-文件夹名称）"><a href="#cd-XXX（目录名称-或者-文件夹名称）" class="headerlink" title="cd XXX（目录名称 或者 文件夹名称）"></a>cd XXX（目录名称 或者 文件夹名称）</h2><p>进入某个目录或者某个文件夹</p>
<p><img src="/images/3.png" alt="img"></p>
<h2 id="cd"><a href="#cd" class="headerlink" title="cd.."></a>cd..</h2><p> 返回上一级</p>
<h2 id="cd-1"><a href="#cd-1" class="headerlink" title="cd../.."></a>cd../..</h2><p>返回上一级的上一级</p>
<h2 id="cd-2"><a href="#cd-2" class="headerlink" title="cd /"></a>cd /</h2><p>返回根路径</p>
<h2 id="cd-盘符"><a href="#cd-盘符" class="headerlink" title="cd (盘符):"></a>cd (盘符):</h2><p>切换盘符</p>
<p><img src="/images/4.png" alt="img"></p>
<h2 id="mkdir-xxx"><a href="#mkdir-xxx" class="headerlink" title="mkdir xxx"></a>mkdir xxx</h2><p>（在当前目录下）创建一个文件夹</p>
<p><img src="/images/5.png" alt="img"></p>
<h2 id="touch-xxx"><a href="#touch-xxx" class="headerlink" title="touch  xxx"></a>touch  xxx</h2><p> （在当前目录下） 创建一个文件</p>
<p><img src="/images/6.png" alt="img"></p>
<h2 id="rm-xxx"><a href="#rm-xxx" class="headerlink" title="rm xxx"></a>rm xxx</h2><p>删除一个文件</p>
<h2 id="rm-xxx-rf"><a href="#rm-xxx-rf" class="headerlink" title="rm xxx -rf"></a>rm xxx -rf</h2><p>强制删除，可以用来删除文件夹</p>
<h2 id="cat-xxx"><a href="#cat-xxx" class="headerlink" title="cat xxx"></a>cat xxx</h2><p>查看文件内容</p>
<p><img src="/images/7.png" alt="img"></p>
<h2 id="clear"><a href="#clear" class="headerlink" title="clear"></a>clear</h2><p>清空当前命令行窗口</p>
<h2 id="code"><a href="#code" class="headerlink" title="code ."></a>code .</h2><p>启动vsCode编辑器 并打开当前目录</p>
<h1 id="git命令，操作仓库"><a href="#git命令，操作仓库" class="headerlink" title="git命令，操作仓库"></a>git命令，操作仓库</h1><h2 id="提交流程"><a href="#提交流程" class="headerlink" title="提交流程"></a>提交流程</h2><p><img src="/images/8.png" alt="img"></p>
<p>1.git clone ‘仓库地址’ ，</p>
<p>2.进入项目目录。</p>
<p>3.克隆后不要直接在master分支中写代码，要先创建一个新的分支，</p>
<p>4.然后切换到这个新的分支（dev），通过git merage master将master分支中的代码复制（合并）到dev中，代码的修改，写入都在这个分支中进行，</p>
<p>5.修改完成后，再切换到master分支中，合并dev的代码，</p>
<p>6.然后在拉去最新代码（git pull  防止当前代码与仓库代码不一致），</p>
<p>7.最后通过 git push远程推送(提交代码到仓库)</p>
<p>注：只要是修改代码等，就在分支中进行，提交则在master中进行</p>
<h2 id="git-clone-‘仓库地址’"><a href="#git-clone-‘仓库地址’" class="headerlink" title="git clone ‘仓库地址’"></a>git clone ‘仓库地址’</h2><p>克隆仓库</p>
<h2 id="git-add"><a href="#git-add" class="headerlink" title="git add ."></a>git add .</h2><p>全部添加到暂存区</p>
<h2 id="git-add-‘要添加的文件名’"><a href="#git-add-‘要添加的文件名’" class="headerlink" title="git add ‘要添加的文件名’"></a>git add ‘要添加的文件名’</h2><p>添加一个文件到暂存区</p>
<h2 id="git-commit-m-“信息”"><a href="#git-commit-m-“信息”" class="headerlink" title="git commit -m “信息”"></a>git commit -m “信息”</h2><p>新建一个版本号</p>
<h2 id="git-pull"><a href="#git-pull" class="headerlink" title="git pull"></a>git pull</h2><p>拉取最新代码（更新）</p>
<h2 id="git-push"><a href="#git-push" class="headerlink" title="git push"></a>git push</h2><p>远程推送 （将修改后的代码，还有相应的版本号和git操作记录，发送给仓库）</p>
<h2 id="创建分支"><a href="#创建分支" class="headerlink" title="创建分支"></a>创建分支</h2><h2 id="git-btanch"><a href="#git-btanch" class="headerlink" title="git btanch"></a>git btanch</h2><p>查看当前分支，有哪些，使用的时哪一个</p>
<h2 id="git-branch-xxx"><a href="#git-branch-xxx" class="headerlink" title="git branch xxx"></a>git branch xxx</h2><p>新建分支</p>
<h2 id="git-checkout-xxx"><a href="#git-checkout-xxx" class="headerlink" title="git checkout xxx"></a>git checkout xxx</h2><p> 切换到某个分支</p>
<h2 id="git-merge-‘要合并的分支’"><a href="#git-merge-‘要合并的分支’" class="headerlink" title="git merge ‘要合并的分支’"></a>git merge ‘要合并的分支’</h2><p>合并代码</p>
<h2 id="git-status"><a href="#git-status" class="headerlink" title="git status"></a>git status</h2><p>查看当前分支状态</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://example.com/2022/03/14/git%E5%9F%BA%E7%A1%80%E5%91%BD%E4%BB%A4%E5%BA%94%E7%94%A8/" data-id="cl0qnthih0000jcw66ykva1f9" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2022/03/15/vue%E5%88%9D%E6%AD%A5%E4%BA%86%E8%A7%A3/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          vue初步了解
        
      </div>
    </a>
  
  
    <a href="/2022/03/14/hello-world/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">Hello World</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/03/">March 2022</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2022/03/23/vuex%E5%AD%A6%E4%B9%A0/">vuex学习</a>
          </li>
        
          <li>
            <a href="/2022/03/22/vuew-router%E7%9A%84%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/">vuew-router的基本使用</a>
          </li>
        
          <li>
            <a href="/2022/03/22/vue-router%E7%9A%84%E5%88%9B%E5%BB%BA%E8%BF%87%E7%A8%8B/">vue-router的创建过程</a>
          </li>
        
          <li>
            <a href="/2022/03/20/axios%E5%AD%A6%E4%B9%A0/">axios学习</a>
          </li>
        
          <li>
            <a href="/2022/03/16/%E4%BA%86%E8%A7%A3vue%E7%BB%84%E4%BB%B6/">了解vue组件</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2022 诶无痕和诶有痕<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">

  
<script src="/fancybox/jquery.fancybox.pack.js"></script>




<script src="/js/script.js"></script>




  </div>
</body>
</html>